<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
</head>
<body>
    <h1>新增用户</h1>
    <form action="users" method="post">
        姓名<input type="text" name="username" />
        密码<input type="text" name="password" />
        余额<input type="text" name="money" />
        <button>提交</button>
    </form>

    <h1>修改用户</h1>
    <button id="btn1">修改</button>

    <h1>删除用户</h1>
    <button id="btn2">删除</button>
    <script>
        var obj ={
             "userid": 997,
             "username":"龙龟",
             "password": "188" ,
             "money": 7788
        };
        $("#btn1").click(()=>{
            $.ajax({
                type:"put",
                contentType:"application/json",
                data: JSON.stringify(obj) ,
                url: "users",
                success:function(result){
                    console.log(result);
                }
            });
        });

        $("#btn2").click(()=>{
            $.ajax({
                type:"delete",
                url: "users/8916",
                success:function(result){
                    console.log(result);
                }
            });
        });
    </script>
    <h1>用户列表</h1>
    <h4> 当前页 ${ pinfo.pageNum }</h4>
    <h4> 每页条 ${ pinfo.pageSize }</h4>
    <h4> 总条数  ${ pinfo.total }</h4>
    <h4> 总页  ${ pinfo.pages }</h4>
    <c:forEach items="${ pinfo.list }" var="t">
       <p>${t.userid} --${t.username} --${t.money}</p>
    </c:forEach>
    <%--    页码的显示 --%>
    <c:forEach items="${pinfo.navigatepageNums}" var="p">
        <a href="users?page=${p}"> ${p} </a> --
    </c:forEach>
</body>
</html>
